<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<style>
.button, .button:visited {
	background: #B34D8A repeat-x;
	display: inline-block;
	padding: 5px 5px 5px;
	color: #fff;
	text-decoration: none;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
	-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
	text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
	border-bottom: 1px solid rgba(0,0,0,0.25);
	position: relative;
	cursor: pointer;
	width:100px;
	font-weight:bold;
	text-align:center;
}
</style>
<div class="easyui-layout" fit="true" >
  <t:formvalid formid="formobj" dialog="true"  layout="table" action="" >
     <div region="center"  style="height:180px;overflow:hidden;" border="0">
         <table style="width: 100%;" cellpadding="0" cellspacing="1" border="0" class="formtable" align="center">
	        <tr>
				<td  width="50%" valign="top">
				   <table style="width: 100%;" cellpadding="0" cellspacing="1"  class="formtable" align="center">
					   <tr height="30">
					      <td colspan="4" align="center"><strong>工单受理信息</strong></td>
					   </tr>
					   <tr height="30">
				            <td  width="15%" align="center"><label class="Validform_label">工单编号 </label></td>
							<td  class="value" width="35%" >
				              <c:choose>
				              	<c:when test="${empty wo.wo95598Id}">
				              		${wo.id }
				              	</c:when>
				              	<c:otherwise>
				              		${wo.wo95598Id }
				              	</c:otherwise>
				              </c:choose>
				            </td>
							<td  width="15%" align="center"><label class="Validform_label">工单状态 </label></td>
							<td  class="value" width="35%" >
							    ${wo.woStateDesc }
				              
				            </td>
						</tr>
						<tr height="30">
				            <td  width="15%" align="center"><label class="Validform_label">工单类型 </label></td>
							<td  class="value" width="35%" >
							   【${wo.woSrcDesc }】${wo.woTypeDesc }
				            </td>
							<td  width="15%" align="center"><label class="Validform_label">关联工单</label></td>
							<td  class="value" width="35%" > 
							    <c:choose>
							        <c:when test="${assoList!= null && fn:length(assoList) > 0}">  
							            <c:forEach var="asso" items="${assoList }" >  
									      <a style="cursor:hand;color:#e59687;" onclick="parent.addTab('${asso.assoWoid }');">${asso.assoWoid }</a>
									    </c:forEach>  
							        </c:when>
							        <c:otherwise> 
							                                      无
							        </c:otherwise>
                                </c:choose>
				            </td>
						</tr>
						<tr height="30">
				            <td  width="15%" align="center"><label class="Validform_label">受理时间 </label></td>
							<td  class="value" width="35%" >
							   <c:choose>
				              	 <c:when test="${empty wo.acDatetime}">
				              		<fmt:formatDate value="${wo.createDatetime}"  type="both" pattern="yyyy.MM.dd HH:mm:ss"/> 
				              	 </c:when>
				              	 <c:otherwise>
				              		${wo.acDatetime }
				              	 </c:otherwise>
				              </c:choose>
							  
							   
				            </td>
							<td  width="15%" align="center"><label class="Validform_label">处理时限</label></td>
							<td  class="value" width="35%" > 
							   ${wo.overTime}
				            </td>
						</tr>
						<tr  height="30">
							<td  width="15%" align="center"><label class="Validform_label">受理内容</label></td>
							<td  class="value" width="85%" colspan="3">
				                <textarea style="height:75px;width:100%;border:0px;" >${wo.woContent }</textarea>
				            </td>
						</tr>
						<tr height="30">
				            <td  width="15%" align="center"><label class="Validform_label">受理部门</label></td>
							<td  class="value" width="35%" >
							   ${wo.createDepartmentname }
							   
				            </td>
							<td  width="15%" align="center"><label class="Validform_label">受理人员</label></td>
							<td  class="value" width="35%" >
							    ${wo.createRealname }
				            </td>
						</tr>
						
						
						<tr height="30">
					      <td colspan="4" align="center"><strong>客户基本信息</strong></td>
					    </tr>
					     <tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">客户编号 </label></td>
							<td  class="value" width="35%">
							    <input type="hidden" value="${wo.todoId }" name="todoId" id="todoId"/>
							    <input type="hidden" value="${wo.id }" name="id" id="id"/>
				                ${wo.customerNo }
				            </td>
				            
				            <td width="15%" align="center"><label class="Validform_label">客户名称 </label></td>
							<td class="value" width="35%">
				                ${wo.customerName }
				            </td>
						</tr>
				         <tr height="30">
				            <td width="15%" align="center"><label class="Validform_label">联系人 </label></td>
							<td class="value" width="35%">
				                ${wo.contactMan }
				            </td>
				             <td width="15%" align="center"><label class="Validform_label">联系地址 </label></td>
							<td class="value" width="35%">
				                ${wo.contactAddress }
				            </td>
						</tr>
						<tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">联系电话</label></td>
							<td  class="value" width="35%">
				                 ${wo.contactPhone }
				            </td>
				            <td  width="15%" align="center"><label class="Validform_label">联系电话2 </label></td>
							<td  class="value" width="35%">
				                ${wo.contactPhone2 }
				            </td>
				           
						</tr>
						
						
		 <!-- 只展示已归档的工单 -->
       
						<tr height="30">
					      <td colspan="4" align="center"><strong>归档回访结果</strong></td>
					    </tr>
					    <tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">归档部门</label></td>
							<td  class="value" width="35%">
				                ${archiveWo.createDepartmentname }
				            </td>
				            
				            <td width="15%" align="center"><label class="Validform_label">归档人员 </label></td>
							<td class="value" width="35%">
				                 ${archiveWo.createRealname }
				            </td>
						</tr>
						
						<tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">归档类型</label></td>
							<td  class="value" width="35%">
				                ${archiveWo.woOperadesc }
				            </td>
				            
				            <td width="15%" align="center"><label class="Validform_label">归档时间 </label></td>
							<td class="value" width="35%">
				                 <fmt:formatDate value="${archiveWo.createDatetime}"  type="both" pattern="yyyy.MM.dd HH:mm:ss"/>
				            </td>
						</tr>
						<tr>
							<td  width="15%" align="center"><label class="Validform_label">归档意见</label></td>
							<td  class="value" width="85%" colspan="3">
				                <textarea style="height:72px;width:100%;border:0px;" >${archiveWo.woOpinion }</textarea>
				            </td>
						</tr>
		
		
						
						
						
					 </table>
				</td>
				
				
				
				<td  width="50%" valign="top">
				    <table style="width: 100%;" cellpadding="0" cellspacing="1"  class="formtable" align="center">
					   <tr height="30">
					      <td colspan="4" align="center"><strong>工单处理流程</strong></td>
					   </tr>
					   <tr >
				          <td colspan="4" align="center" width="50%" valign="top" >
				            <div style="height:245px;overflow-y:scroll;border:none;">
				             <table style="width: 100%;" cellpadding="0" cellspacing="1" class="formtable" align="center">
					             <tr height="30">
					                <td  width="5%" align="center"><strong>序号</strong></td>
						            <td  width="20%" align="center"><strong>流程名称</strong></td>
									<td  width="20%" align="center"><strong>处理部门</strong></td>
									<td  width="20%" align="center"><strong>处理人</strong></td>
									<td  width="25%" align="center"><strong>处理时间</strong></td>
									<td  width="10%" align="center"><strong>用时</strong></td>
								 </tr>
			<!-- 遍历处理意见 -->			
			<c:forEach var="process" items="${processList }" varStatus="status">  
				<tr height="30" style="cursor:hand;background:#FFFFFF;" onclick="showWoProcessDetail('${process.id }');" 
				           onmouseover="$(this).css({'background-color':'#CCE6FF'});" onmouseout="$(this).css({'background-color':'#FFFFFF'});">
				    <td   align="center" >${status.count }</td>
				    <td   align="center">${process.woOperadesc }</td>
					<td   align="center" > ${process.createDepartmentname }</td>
					<td   align="center" >${process.createRealname }</td>
					<td   align="center" ><fmt:formatDate value="${process.createDatetime}"  type="both" pattern="yyyy.MM.dd HH:mm:ss"/> </td>
		            <td   align="center" >${process.useHours }</td>
				</tr>
			</c:forEach>				                
				             </table>	
				             </div>			           
				          </td>
						</tr>
						
						<tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">用时</label></td>
							<td  class="value" width="35%">
				                 <label id="id_usertime">${USERHOURS }小时</label>
                            </td>
				            
				            <td width="15%" align="center"><label class="Validform_label">${REMAINTITLE} </label></td>
							<td class="value" width="35%">
				                 <label id="id_overplutime">${REMAINTIME }</label>
				            </td>
						</tr> 
						
						
						<tr height="30">
						    <td colspan="4" align="center"><strong>工单处理详情</strong></td>
						</tr>						
				        <tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">处理部门</label></td>
							<td  class="value" width="35%">
				                 <label id="id_createDepartmentname">${lastWp.createDepartmentname }</label>
                            </td>
				            
				            <td width="15%" align="center"><label class="Validform_label">处理人员 </label></td>
							<td class="value" width="35%">
				                 <label id="id_createRealname">${lastWp.createRealname }</label>
				            </td>
						</tr>
						
						<tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">处理类型</label></td>
							<td  class="value" width="35%">
				                <label id="id_processType">${lastWp.processType }</label>
				            </td>
				            
				            <td width="15%" align="center"><label class="Validform_label">处理户号 </label></td>
							<td class="value" width="35%">
				                 <label id="id_processCustomerNo">${lastWp.processCustomerNo }</label>
				            </td>
						</tr>
						<tr height="30">
							<td  width="15%" align="center"><label class="Validform_label">责任人</label></td>
							<td  class="value" width="35%">
				                <label id="id_responer">${lastWp.responer }</label>
				            </td>
				            
				            <td  width="15%" align="center"><label class="Validform_label">考核</label></td>
							<td  class="value" width="35%">
				                <label id="id_isCheck">${lastWp.isCheck }</label>
				            </td>
						</tr>
						<tr height="30">
							<td width="15%" align="center"><label class="Validform_label">处理时间 </label></td>
							<td class="value" width="85%" colspan="3">
				                 <label id="id_createDatetime">
				                 	<fmt:formatDate value="${lastWp.createDatetime}"  type="both" pattern="yyyy.MM.dd HH:mm:ss"/>
				                 </label>
				            </td>
						</tr>
						<tr>
							<td  width="15%" align="center"><label class="Validform_label">处理意见</label></td>
							<td  class="value" width="85%" colspan="3">
				                <textarea style="height:80px;width:100%;border:0px;" id="id_woOpinion">${lastWp.woOpinion }</textarea>
				            </td>
						 
				    
				         </tr>
		   
					</table>
	            </td>
		           
			</tr>
			
			
			
	         
         </table>
	     
	 </div>
   </t:formvalid>
</div>


<script>

  function showWoDetail(id){
	  createdetailwindow("工单详情","woController.do?woDetail&wo_id=" + id,1200,600);
		 
  }

   function showWoProcessDetail(id){
	   	$.ajax({
			async : false,
			cache : false,
			type : 'GET',
			url : "woController.do?showWoProcessDetail&process_id="+id,
			error : function() {// 请求失败处理函数
			},
			success : function(data) {
				var d = $.parseJSON(data);
				if (d.success) {	
					 $('#id_createDepartmentname').html(d.obj.createDepartmentname);
					 $('#id_createRealname').html(d.obj.createRealname);
					 $('#id_processType').html(d.obj.processType);
					 $('#id_woOpinion').val(d.obj.woOpinion);
					 $('#id_isCheck').html(d.obj.isCheck);
					 
					 $('#id_processCustomerNo').html(d.obj.processCustomerNo);
					 $('#id_responer').html(d.obj.responer);
					 
					 var date = new Date();
					 date.setTime(d.obj.createDatetime);
					 $('#id_createDatetime').html(formatDateTime(date));				
				}    			
			}
		}); 
	   
   }
   
   var formatDateTime = function (date) {  
	    var y = date.getFullYear();  
	    var m = date.getMonth() + 1;  
	    m = m < 10 ? ('0' + m) : m;  
	    var d = date.getDate();  
	    d = d < 10 ? ('0' + d) : d;  
	    var h = date.getHours();  
	    h = h < 10 ? ('0' + h) : h;  
	    var minute = date.getMinutes();  
	    minute = minute < 10 ? ('0' + minute) : minute;  
	    var seconds = date.getSeconds();  
	    seconds = seconds < 10 ? ('0' + seconds) : seconds;  
	    
	    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+seconds;  
	};  
	
</script>